<?php
/**
 * Author: lee wei
 * Date: 2021/12/8
 */declare (strict_types=1);
namespace app\admin\service;

class BaseService
{

    /**
     * 错误内容
     */
    //protected string $error = '';
    //self 当前类  static 当前使用的类（调用类）
    protected static $instance;
    protected $error;

    public static function getInstance()
    {
        if(!static::$instance instanceof self){
            static::$instance = new static();
        }

        return static::$instance;
    }


    private function __construct(){
    }

    private function __clone(){
    }



    /**
     * 获取最后产生的错误
     * @return string
     */
    public function getError()
    {
        return $this->error;
    }

    /**
     * 设置错误
     * @param string $error 信息信息
     */
    public function setError(string $error)
    {
        $this->error = $error;
    }

}